package com.jml.dubbo.server.discover;

import java.util.List;

import org.I0Itec.zkclient.ZkClient;


public class ServiceDiscoverImpl implements ServiceDiscover {
    /**
     * zk连接地址
     */
    private final String zkServers = "127.0.0.1";
    /**
     * 会话时间
     */
    private final int connectionTimeout = 5000;
    /***
     * zkClient
     */
    private ZkClient zkClient;


    private String rootNamePath = "/jml_rpc";

    public ServiceDiscoverImpl() {
        // 1. 连接zk连接
        zkClient = new ZkClient(zkServers, connectionTimeout);
    }

    @Override
    public List<String> getDiscover(String serviceName) {
        List<String> children = zkClient.getChildren(rootNamePath + "/" + serviceName + "/providers");
        return children;
    }
    // 负载均衡器 轮训、权重、取模、随机、一致性；

    /**
     * 负载均衡器  策略 loop
     */
}
